<?php
// +---------------------------------------------------------------------------+
// | This file is part of the KnowledgebasePublisher package                   |
// | KnowledgebasePublisher - web based knowledgebase publisher tool           |
// |                                                                           |
// | Author:  Evgeny Leontev <eleontev@gmail.com>                              |
// | Copyright (c) 2005 Evgeny Leontev                                         |
// |                                                                           |
// | For the full copyright and license information, please view the LICENSE   |
// | file that was distributed with this source code.                          |
// +---------------------------------------------------------------------------+


class FileEntryView_common
{
	
	function parseCategories(&$obj, &$manager, &$tpl) {
		
		// categories
		$categories = &$manager->getCategoryRecords();
		$range = &$manager->getCategorySelectRange($categories);
		$category_id = ($obj->getCategory()) ? $obj->getCategory() : array(current(array_keys($range)));		
		
		$select = new FormSelect();
		$select->select_tag = false;
		$select->setRange($range);

		foreach($categories as $k => $v) {
			if($v['private']) {
				$select->setOptionParam($k, 'style="color: #cc0033;"');
			}
		}
		
		$tpl->tplAssign('category_select', $select->select($category_id));
		
		$select->setRange($range);		
		$tpl->tplAssign('category_mirror_select', $select->select($obj->getCategoryMirror()));		
	}
}
?>